<?php

namespace app\api\controller;

use app\api\logic\article\ArticleSet as ArticleSetLogic;
use app\api\logic\article\ArticleTag as ArticleTagLogic;
use app\api\logic\article\ArticleType as ArticleTypeLogic;
use app\api\logic\article\ArticleComment as ArticleCommentLogic;

class Article
{
    use \app\common\traits\Controller;

    public function __construct(
        ArticleSetLogic $articleSetLogic,
        ArticleTagLogic $articleTagLogic,
        ArticleTypeLogic $articleTypeLogic,
        ArticleCommentLogic $articleCommentLogic
    )
    {
        $this->articleSetLogic = $articleSetLogic;
        $this->articleTagLogic = $articleTagLogic;
        $this->articleTypeLogic = $articleTypeLogic;
        $this->articleCommentLogic = $articleCommentLogic;
    }

    public function getArticles()
    {
        return self::httpResp($this->articleSetLogic->getArticles());
    }

    public function getTags()
    {
        return self::httpResp($this->articleTagLogic->getTags());
    }

    public function getTypes()
    {
        return self::httpResp($this->articleTypeLogic->getTypes());
    }

    public function getComment()
    {
        return self::httpResp($this->articleCommentLogic->lst());
    }

    public function getByUserId()
    {
        return self::httpResp($this->articleSetLogic->getByUserId());
    }

    public function search()
    {
        return self::httpResp($this->articleSetLogic->search());
    }
}
